<?php
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Database\Eloquent\SoftDeletes;
use Traits\HasUuid;

class WorkPaperModel extends Model
{
    use HasFactory, HasUuid, SoftDeletes;

    protected $table = 'work_papers';

    protected $hidden = ["deleted_at"];

    protected $fillable = [];

    public function user(): BelongsToMany
    {
        return $this->belongsToMany(UserModel::class, 'work_paper_users',
            'work_paper_id', 'user_id');
    }
    public function paperUser(): HasOne
    {
        return $this->hasOne(WorkPaperUserModel::class, "work_paper_id","id");
    }
}
